﻿@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@model List<ECG.Common.ProductRateByCateTopListPagingDto>
@if (Model.Any())
{
    <div class="productCusInteres">
        <div class="interes-header">
            <span><strong>SẢN PHẨM ĐƯỢC QUAN TÂM</strong><br />
                <font color="#a1a1a1">[ Những sản phẩm được quan tâm và đánh giá cao về chất lượng ]</font>
            </span>
        </div>
        <ul class="interesList ul">
            @foreach (var item in Model)
            {
                var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                <li class="clearfix">
                    <div class="interes-left fl">
                        <a href="@pDetailLink">
                            <img src="@item.ImagePath.ImagePathThumb(65, 65)" width="65" height="65" alt="@item.Name" />
                        </a>
                    </div>
                    <div class="interes-right fl">
                        <h4>
                            <a href="@pDetailLink">@item.Name
                            </a>
                        </h4>
                        @if (item.PromotionPrice > 0)
                        {
                            <p class="pItem-PriceOld">
                                @item.Price.ToString("##,###,###") đ
                            </p>
                            <p>
                                <span class="pItem-PriceNew interes-price">@item.PromotionPrice.ToString("##,###,###") đ</span>
                            </p>
                        }
                        else
                        {
                            <p>
                                <span class="pItem-PriceNew interes-price">@item.Price.ToString("##,###,###") đ</span>
                            </p>
                        }

                        <div style="line-height: 13px; margin: 5px 0px;">
                            @{
                        var starPercent = "0";
                        if (item.AverageRate > 0)
                        {
                            starPercent = (Convert.ToDouble(item.AverageRate) * 100 / 5).ToString("#.#").Replace(',', '.');
                        }
                            }
                            <span class="itm-ratStars inlineBlocka"><span style="width: @starPercent%;" class="itm-ratStars itm-ratRating"></span></span>
                        </div>
                    </div>
                </li>
            }
        </ul>
        <div class="interes-pagging">
            @{
            for (int i = 1; i <= ViewBag.TotalPage; i++)
            {
                if(i==ViewBag.CurrentPage)
                {
                    <a href="javascript:void(0)" rel="nofollow" class="in-ac" onclick="getInteresPaggin('@ViewBag.productIdHis','@i',this)">@i</a>
                }
                else
                {
                    <a href="javascript:void(0)" rel="nofollow" onclick="getInteresPaggin('@ViewBag.productIdHis','@i',this)">@i</a>
                }
            }
            }
        </div>
    </div>
}